﻿/*****************************************************************************  

 Version: 0.1
 Website: http://www.visuagile.com/
 
 Copyright (c) Yoganand R. All rights reserved.
 For continued development and updates, visit http://yogsbreath.net
 
 ******************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VisualAgile.Model;

namespace VisualAgile.DTO.Mappers
{
    public class ActualsDTOMapper:BaseDTOMapper
    {
        public static ActualsDTO MapToDTO(Actual model)
        {
            ActualsDTO dto = new ActualsDTO();            

            dto.ActualsID = model.ActualID;            
            dto.Remain = model.Remain;            
            dto.TaskID = model.TaskID;
            dto.LabelID = model.Label == null ? "" : model.Label.LabelID.ToString();
            dto.Label = model.Label == null ? "" : model.Label.Date;
            dto.CreateTime = model.CreateTime;
            dto.Creator = model.Creator;

            return dto;
        }

        public static Actual MapFromDTO(ActualsDTO dto)
        {
            Actual Actual = new Actual();            
            Actual.ActualID = dto.ActualsID;
            Actual.Remain = dto.Remain;            
            Actual.TaskID = dto.TaskID;
            Actual.Label = (dto.LabelID == null || dto.LabelID == "") ? null : ManagerFactory.LabelManager.Get(new Guid(dto.LabelID));
            Actual.CreateTime = dto.CreateTime;
            Actual.Creator = dto.Creator;
            return Actual;
        }
    }
}
 